home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1999 May / SGI IRIX 6.5 Applications 1999 May.iso / dist / demos.idb / usr / demos / General_Demos / CyberAnatomy101 / RUN.z / RUN
Encoding:
Text File  |  1999-04-09  |  4.9 KB  |  133 lines

  1. #!/bin/sh
  2. #Tag 0x9085
  3.  
  4. #**************************************************************************
  5. #*                                                      *
  6. #*          Copyright (c) 1996 Silicon Graphics, Inc.               *
  7. #*                  All Rights Reserved                         *
  8. #*                                                      *
  9. #*       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF SGI           *
  10. #*                                                      *
  11. #* The copyright notice above does not evidence any actual of intended    *
  12. #* publication of such source code, and is an unpublished work by Silicon *
  13. #* Graphics, Inc. This material contains CONFIDENTIAL INFORMATION that is *
  14. #* the property of Silicon Graphics, Inc. Any use, duplication or       *
  15. #* disclosure not specifically authorized by Silicon Graphics is strictly *
  16. #* prohibited.                                              *
  17. #*                                                      *
  18. #* RESTRICTED RIGHTS LEGEND:                                    *
  19. #*                                                      *
  20. #* Use, duplication or disclosure by the Government is subject to       *
  21. #* restrictions as set forth in subdivision (c)(1)(ii) of the Rights in   *
  22. #* Technical Data and Computer Software clause at DFARS 52.227-7013,      *
  23. #* and/or in similar or successor clauses in the FAR, DOD or NASA FAR     *
  24. #* Supplement. Unpublished - rights reserved under the Copyright Laws of  *
  25. #* the United States. Contractor is SILICON GRAPHICS, INC., 2011 N.       *
  26. #* Shoreline Blvd., Mountain View, CA 94039-7311                    *
  27. #**************************************************************************
  28.  
  29. # Where do we want to go
  30. URL="file:/usr/demos/General_Demos/CyberAnatomy101/data/intro.html"
  31.  
  32.  
  33. #
  34. # Default place to start up Netscape at,
  35. # currently assuming a 1280x1024 display
  36. #
  37. #GEOMETRY should be of the form "1250x970+15+0"
  38. GEOMETRY="1250x970+15+0"
  39.  
  40. NETSCAPE_3PREF="/usr/demos/Demo_Interfaces/Web/common/preferences"
  41. NETSCAPE_4PREF="/usr/demos/Demo_Interfaces/Web/common/preferences.js"
  42. NETSCAPE_4XDEFAULTS="/usr/demos/Demo_Interfaces/Web/common/Xdefaults"
  43.  
  44. remove_lock() {
  45.    if [ -l $HOME/.netscape/lock ]
  46.    then
  47.       rm $HOME/.netscape/lock
  48.    fi
  49. }
  50.  
  51. launch_ns() {
  52.    remove_lock
  53.    #
  54.    # since an $HOME/.Xdefaults file overrides Netscape's -geometry option
  55.    # we have to use -xrm which overrides .Xdefaults. (The demos account provides
  56.    # an $HOME/.Xdefaults file so that Netscape is a little larger than normal.)
  57.    # Some users may have also specified Netscape geometry in their $HOME/.Xdefaults file.
  58.    # So do the right thing and specify what we want.
  59.    #
  60.    /usr/bin/X11/netscape -xrm "Netscape.Navigator.geometry: $GEOMETRY" $URL &
  61. }
  62.  
  63. # Parse netscape -v output
  64. NSVERSION=`/usr/bin/X11/netscape -version 2>&1 | /usr/sbin/perl -ne 'if ( /^\w*\s*\w*\s*(\d+\.\w+).*$/ ) {print "$1\n";}'`
  65.  
  66. case "$NSVERSION" in
  67.  
  68.    # If not Communicator then at least try Netscape with Navigator's environment
  69.    3*)
  70.        # If USER null, assume script is being run from the Web Interface
  71.        # under the USER name as nobody. So we need to set up a fake home
  72.        # directory. 
  73.        if [ -z "$USER" ]
  74.        then
  75.           HOME="/tmp/nobodyNetscapeHome" ; export HOME
  76.           if [ ! -d $HOME ]
  77.           then
  78.              mkdir -p $HOME/.netscape/cache
  79.              if [ -f $NETSCAPE_3PREF ]
  80.              then
  81.                 cp $NETSCAPE_3PREF $HOME/.netscape
  82.              fi
  83.           fi
  84.           launch_ns
  85.  
  86.        # If USER is set then assume this script was run from the desktop
  87.        # Either demos or another user
  88.        else
  89.           launch_ns
  90.        fi
  91.        ;;
  92.  
  93.    *)
  94.        # If USER null, assume script is being run from the Web Interface
  95.        # under the USER name as nobody. So we need to set up a fake home
  96.        # directory, else run netscape4
  97.        if [ -z "$USER" ]
  98.        then
  99.           HOME="/tmp/nobodyNetscapeHome" ; export HOME
  100.           if [ ! -d $HOME ]
  101.           then
  102.              mkdir -p $HOME/.netscape/cache $HOME/.netscape/archive
  103.              # the preferences file has browser width and height which
  104.              # netscape 4 will respect, but no way for absolute positioning
  105.              # in the preferences
  106.              if [ -f $NETSCAPE_4PREF ]
  107.              then
  108.                 cp $NETSCAPE_4PREF $HOME/.netscape
  109.              fi
  110.              launch_ns
  111.  
  112.           # If $HOME is set up check to see if it has the old preferences file and replace it
  113.           else
  114.              if [ -f $HOME/.netscape/preferences ]
  115.              then
  116.                 rm $HOME/.netscape/preferences
  117.              fi
  118.              if [ ! -f $HOME/.netscape/preferences.js ]
  119.              then
  120.                 if [ -f $NETSCAPE_4PREF ]
  121.                 then
  122.                    cp $NETSCAPE_4PREF $HOME/.netscape
  123.                 fi
  124.              fi
  125.              launch_ns
  126.           fi
  127.        else
  128.           launch_ns
  129.        fi
  130.        ;;
  131.  
  132. esac
  133.